package gttp.nspa.client.adm;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
import com.sencha.gxt.core.client.GXT;
import com.sencha.gxt.state.client.CookieProvider;
import com.sencha.gxt.state.client.StateManager;

public class Main implements EntryPoint {

    public void onModuleLoad() {
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                StateManager.get().setProvider(new CookieProvider("/", null, null, GXT.isSecure()));

                NsGinjector gin = GWT.create(NsGinjector.class);
                NsApp app = gin.getApp();
                app.run();

                onReady();
            }

        });
    }

    private native void onReady() /*-{
                                  if (typeof $wnd.GxtReady != 'undefined') {
                                  $wnd.GxtReady();
                                  }
                                  }-*/;
}
